﻿<%@ Page Title="Add Component" Language="C#" MasterPageFile="~/MasterPage.master"
   AutoEventWireup="true" CodeFile="AddComponent.aspx.cs" Inherits="AddComponent"
   ValidateRequest="false" %>

<%@ Register Src="Authors.ascx" TagName="Authors" TagPrefix="nmr" %>
<%-- Custom made page for screwturn wiki --%>
<asp:Content ID="Content1" ContentPlaceHolderID="CphMaster" runat="Server"
   style="max-width: 700px">
   <h1 class="pagetitlesystem">
      <asp:Literal ID="lblTitle" runat="server" meta:resourcekey="lblTitleResource1"
         Text="Add Component" />
   </h1>
   <asp:ScriptManager ID="ScriptManager1" runat="server">
   </asp:ScriptManager>
   <asp:UpdatePanel runat="server">
      <ContentTemplate>
         <asp:Panel ID="Panel1" runat="server" Style="margin-left: 770px; padding-bottom: 10px;
            padding-left: 0px; width: 330px; position: absolute; left: 0px; top: 200px">
            <nmr:Authors ID="AuthorsList" runat="server" />
            <asp:CustomValidator ID="CustomValidator2" runat="server" ControlToValidate="AuthorsList"
               Style="vertical-align: top" EnableClientScript="False" ErrorMessage="At lease one author must be added."
               OnServerValidate="ValidateAuthorsNumber" ValidateEmptyText="false" Display="Dynamic">
            </asp:CustomValidator>
         </asp:Panel>
      </ContentTemplate>
      <Triggers>
         <asp:AsyncPostBackTrigger ControlID="butClear" EventName="Click" />
         <asp:AsyncPostBackTrigger ControlID="butSubmit" EventName="Command" />
      </Triggers>
   </asp:UpdatePanel>
   <asp:UpdatePanel runat="server">
      <ContentTemplate>
         <asp:Label ID="lblName" runat="server" Text="Name" Width="150px" Style="margin-bottom: 3px"></asp:Label>
         <asp:Panel runat="server">
            <asp:TextBox ID="tbName" runat="server" Columns="80" Width="550px" Font-Size="14px"
               CssClass="InputField"></asp:TextBox>
            <asp:RequiredFieldValidator ID="valReqFieldName" runat="server" ControlToValidate="tbName"
               Display="Dynamic" ErrorMessage="<br />Name Must Be Present." SetFocusOnError="True">
            </asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server"
               ControlToValidate="tbName" Display="Dynamic" ErrorMessage="Name must contain only Letters and Spaces."
               ValidationExpression="[A-z0-9][.0-9A-z\s]+" SetFocusOnError="True">
            </asp:RegularExpressionValidator>
         </asp:Panel>
         <br />
         <asp:Label ID="lblMemo" runat="server" Text="Short Description" Width="150px"
            Style="margin-bottom: 3px">
         </asp:Label>
         <asp:Panel runat="server">
            <asp:TextBox ID="tbMemo" CssClass="InputField" runat="server" MaxLength="2000"
               Rows="2" TextMode="MultiLine" Width="550px" Font-Size="14px">
            </asp:TextBox>
            <asp:RequiredFieldValidator ControlToValidate="tbMemo" Display="Dynamic"
               Text="<br />Short description must be present." runat="server">
            </asp:RequiredFieldValidator>
            <asp:RegularExpressionValidator ID="RegularExpressionValidator3" Style="vertical-align: top"
               runat="server" ControlToValidate="tbMemo" Display="Dynamic" ErrorMessage="<br />Short Description Should Not Contain &lt;&gt; Charachters."
               ValidationExpression="[A-z0-9\s\\/:.,?!@#$;%^&amp;-*()\\]*">
            </asp:RegularExpressionValidator>
         </asp:Panel>
         <br />
         <asp:Panel runat="server" ID="panScriptType" Visible="false">
            <asp:Label ID="lblType" runat="server" Text="Type" Width="150px" Style="margin-bottom: 3px">
            </asp:Label>
            <asp:Panel runat="server">
               <asp:TextBox ID="tbType" runat="server" Columns="80" Width="550px" Font-Size="14px"
                  CssClass="InputField">
               </asp:TextBox>
               <asp:RequiredFieldValidator runat="server" Display="Dynamic" ControlToValidate="tbType"
                  ErrorMessage="<br /> Type must be present." Style="vertical-align: top;" />
            </asp:Panel>
            <br />
         </asp:Panel>
         <asp:Label ID="lblContent" runat="server" Text="Content" Width="150px"
            Style="vertical-align: top">
         </asp:Label>
         <asp:Panel runat="server">
            <asp:TextBox ID="tbContent" runat="server" MaxLength="50000" CssClass="InputField"
               Font-Size="14px" Rows="20" TextMode="MultiLine" Width="550px">
            </asp:TextBox>
            <asp:CustomValidator ID="CustomValidator1" runat="server" ControlToValidate="tbContent"
               Style="vertical-align: top" EnableClientScript="False" ErrorMessage="<br />Scripts Are Not Allowed."
               OnServerValidate="ValidateForScripts" ValidateEmptyText="True" Display="Dynamic">
            </asp:CustomValidator>
            <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
               Style="vertical-align: top" ControlToValidate="tbContent" Display="Dynamic"
               ErrorMessage="<br />Content must be present.">
            </asp:RequiredFieldValidator>
         </asp:Panel>
         <br />
         <asp:Button ID="butSubmit" runat="server" Text="Submit" OnCommand="butSubmit_Command" />
         <asp:Button ID="butClear" runat="server" CausesValidation="False" OnClick="butClear_Click"
            Text="Clear" />
      </ContentTemplate>
      <Triggers>
        <%-- <asp:AsyncPostBackTrigger ControlID="butClear" EventName="Click" />
         <asp:AsyncPostBackTrigger ControlID="butSubmit" EventName="Command" />--%>
      </Triggers>
   </asp:UpdatePanel>
</asp:Content>
